package cn.lili.modules.promotion.entity.dos;

import cn.lili.modules.promotion.entity.vos.BlindboxRuleVO;
import cn.lili.modules.promotion.entity.vos.CouponVO;
import cn.lili.mybatis.model.BaseStandardEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * @author xiangqian
 */
@Data
@TableName("li_blindbox_rule")
@ApiModel(value = "盲盒规则")
public class BlindboxRule extends BaseStandardEntity {

    private static final long serialVersionUID = 1L;

    /**
     * 规则CODE
     */
    @ApiModelProperty(name = "规则CODE", notes = "")
    private String ruleCode;
    /**
     * 规则名称
     */
    @ApiModelProperty(name = "规则名称", notes = "")
    @NotBlank(message = "规则名称不能为空!")
    private String ruleName;
    /**
     * 规则类型
     */
    @ApiModelProperty(name = "规则类型", notes = "")
    private String ruleType;
    /**
     * 总次数（达到多少次开奖）
     */
    @ApiModelProperty(name = "总次数（达到多少次开奖）", notes = "")
    @NotNull(message = "总次数（达到多少次开奖）不能为空")
    private Integer ruleNum;
    /**
     * 购买次数（购买多少次算一次奖卷）
     */
    @ApiModelProperty(name = "购买次数（购买多少次算一次奖卷）", notes = "")
    @NotNull(message = "总次数（达到多少次开奖）不能为空")
    private Integer ruleBuyNum;
    /**
     * 开奖时间（次日几点开奖）
     */
    @ApiModelProperty(name = "开奖时间（次日几点开奖）", notes = "")
    @NotBlank(message = "开奖时间（次日几点开奖）不能为空!")
    @Pattern(regexp = "^\\d{2}:\\d{2}$", message = "时间格式错误。只能为小时:分钟，如09:20")
    private String startPrizeTime;


    @ApiModelProperty(name = "奖品名称", notes = "")
    @NotBlank(message = "奖品名称不能为空!")
    private String prizeName;

    @ApiModelProperty(name = "奖品图片", notes = "")
    @NotBlank(message = "奖品图片不能为空!")
    private String prizeImage;

    @ApiModelProperty(name = "是否使用", notes = "")
    private Boolean isUse;
    public BlindboxRule(){

    }

    public BlindboxRule(BlindboxRuleVO blindboxRuleVO) {
        BeanUtils.copyProperties(blindboxRuleVO, this);
    }
}